package work931;

/**
 * 角色基类
 * 提供英雄和怪兽的共同属性和方法
 */
public class Role {
    protected String name;
    protected int level;
    protected int blood;
    protected String kind;
    protected int power;
    protected int defence;

    public Role() {
    }

    public Role(String name, int level, int blood, String kind, int power, int defence) {
        this.name = name;
        this.level = level;
        this.blood = blood;
        this.kind = kind;
        this.power = power;
        this.defence = defence;
    }

    /**
     * 死亡判定方法
     * @return 返回true代表已死亡，返回false代表健在
     */
    public boolean isDead() {
        return this.blood <= 0;
    }

    /**
     * 获取角色信息的方法
     */
    public void show() {
        System.out.println("角色名称：" + name);
        System.out.println("角色等级：" + level);
        System.out.println("角色血量：" + blood);
        System.out.println("角色种类：" + kind);
        System.out.println("角色攻击力：" + power);
        System.out.println("角色防御力：" + defence);
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return level
     */
    public int getLevel() {
        return level;
    }

    /**
     * 设置
     * @param level
     */
    public void setLevel(int level) {
        this.level = level;
    }

    /**
     * 获取
     * @return blood
     */
    public int getBlood() {
        return blood;
    }

    /**
     * 设置
     * @param blood
     */
    public void setBlood(int blood) {
        this.blood = blood;
    }

    /**
     * 获取
     * @return kind
     */
    public String getKind() {
        return kind;
    }

    /**
     * 设置
     * @param kind
     */
    public void setKind(String kind) {
        this.kind = kind;
    }

    /**
     * 获取
     * @return power
     */
    public int getPower() {
        return power;
    }

    /**
     * 设置
     * @param power
     */
    public void setPower(int power) {
        this.power = power;
    }

    /**
     * 获取
     * @return defence
     */
    public int getDefence() {
        return defence;
    }

    /**
     * 设置
     * @param defence
     */
    public void setDefence(int defence) {
        this.defence = defence;
    }

    public String toString() {
        return "Role{name = " + name + ", level = " + level + ", blood = " + blood + ", kind = " + kind + ", power = " + power + ", defence = " + defence + "}";
    }
}
